"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const getSysTaskList_1 = __importDefault(require("../lib/System/getSysTaskList"));
const getPidUsage_1 = __importDefault(require("../lib/System/getPidUsage"));
const netWorkMana_1 = __importDefault(require("../lib/System/netWorkMana"));
const getDeviceList_1 = __importDefault(require("../lib/System/getDeviceList"));
const startEXE_1 = __importDefault(require("../lib/System/startEXE"));
const koa_router_1 = __importDefault(require("koa-router"));
const getServerInfo_1 = __importDefault(require("../lib/System/getServerInfo"));
const getWlanInfo_1 = __importDefault(require("../lib/System/getWlanInfo"));
const getBatteryReport_1 = __importDefault(require("../lib/System/getBatteryReport"));
const getCPUUsage_1 = __importDefault(require("../lib/System/getCPUUsage"));
const getGPUUsage_1 = __importDefault(require("../lib/System/getGPUUsage"));
const getMemoryUsage_1 = __importDefault(require("../lib/System/getMemoryUsage"));
const WindowsInfo = new koa_router_1.default({ prefix: '/WindowsInfo' });
WindowsInfo
    .get('/getServerInfo', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '成功获取计算机基本信息',
        data: await (0, getServerInfo_1.default)()
    };
})
    .get('/getSysTaskList', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '成功获取操作系统进程的任务列表',
        data: await (0, getSysTaskList_1.default)()
    };
})
    .get('/getPidUsage', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    const pid = ctx.request.query.pid;
    ctx.body = {
        code: 200,
        message: '线程的使用率-' + pid,
        data: await (0, getPidUsage_1.default)(Number(pid) || 0)
    };
})
    .get('/getNetworkList', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '获取设备网络列表',
        data: await netWorkMana_1.default.getRecently()
    };
})
    .get('/startEXE', async (ctx) => {
    const exePath = ctx.request.query.exePath;
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '启动EXE',
        data: await (0, startEXE_1.default)(exePath)
    };
})
    .get('/getDeviceList', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '计算机的设备列表',
        data: await (0, getDeviceList_1.default)()
    };
})
    .get('/getCPUUsage', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '获取CPU的占用率',
        data: await (0, getCPUUsage_1.default)()
    };
})
    .get('/getGPUUsage', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '获取GPU的占用率',
        data: await (0, getGPUUsage_1.default)()
    };
})
    .get('/getMemoryUsage', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '获取内存的占用率',
        data: await (0, getMemoryUsage_1.default)()
    };
})
    .get('/getBatteryReport', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '获取电池报告',
        data: await (0, getBatteryReport_1.default)()
    };
})
    .get('/getWlanInfo', async (ctx) => {
    ctx.set('content-type', 'application/json;charset=utf-8');
    ctx.set('sis-format', 'on');
    ctx.body = {
        code: 200,
        message: '无线网络连接状态',
        data: await (0, getWlanInfo_1.default)()
    };
});
exports.default = WindowsInfo;
